// 发送ajax - ip
function getAjaxIP() {
    return "https://tchatapi.wedochina.cn";
}

var u = navigator.userAgent;
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端

// 获取地址栏参数
var tools = {
    getSearchObj: function () {
        //获取地址栏参数,封装成一个对象
        var search = location.search;
        //对search字符串进行解码
        search = decodeURI(search);
        search = search.slice(1);
        var arr = search.split("&");
        var obj = {};
        arr.forEach(function (v) {
            var key = v.split("=")[0];
            var value = v.split("=")[1];
            obj[key] = value;
        });
        return obj;
    },
    getSearch: function (key) {
        return this.getSearchObj()[key];
    }
}


$.fn.prevAll = function (selector) {
    var prevEls = [];
    var el = this[0];
    if (!el) return $([]);
    while (el.previousElementSibling) {
        var prev = el.previousElementSibling;
        if (selector) {
            if ($(prev).is(selector)) prevEls.push(prev);
        }
        else prevEls.push(prev);
        el = prev;
    }
    return $(prevEls);
};